<!--
 * @Author: [kangjie]
 * @Date: 2022-03-30 10:49:39
 * @LastEditors: [kangjie]
 * @LastEditTime: 2022-03-30 14:53:21
 * @Description: 
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

</head>

<body>
  <div id="app">
    <form action="test.html">
      <!-- 表单 使用v-model指令对表单进行双向数据绑定-->
      {{stu}}
      <br>
      用户名: <input type="text" v-model.lazy="stu.username">
      <br>
      年龄: <input type="text" v-model="stu.age">
      <br>
      性别：
      男 :<input type="radio" value="male" v-model="stu.gender">
      女 :<input type="radio" value="female" v-model="stu.gender">
      <br>
      <!-- 多选框 -->
      游泳:<input type="checkbox" value="swimming" v-model="stu.hobbies">
      篮球:<input type="checkbox" value="baseketball" v-model="stu.hobbies">
      足球:<input type="checkbox" value="football" v-model="stu.hobbies">
      <!-- 下拉框 -->
      <select v-model="stu.city">
        <option value="shanghai">上海</option>
        <option value="beijing">北京</option>
        <option value="guangzhou">广州</option>
      </select>
      <!-- 多行文本框 -->
      留言:<textarea v-model="stu.info"></textarea>
      <!-- <input type="submit" value="提交表单数据"> -->
    </form>
  </div>
  <script>
    new Vue({
      el: '#app',
      data: {
        // 表单对象
        stu: {
          hobbies: []
        }
      },
      methods: {

      }
    })
  </script>
</body>

</html>